package com.woniu.gf.pawn.comm.core.dto;

import lombok.Data;

@Data
public class PageReultDto extends ResultDto{
    private long totalCount;

    private long totalPage;

    private long pageIndex;

    private long pageSize;

    private Object content;

    public PageReultDto(boolean success, Integer code, String message, long totalCount, long pageIdx, long pageSize, Object content) {
        super(success, code, message);
        this.totalCount = totalCount;
        this.pageIndex = pageIdx;
        this.pageSize = pageSize;
        this.content = content;
        this.totalPage = totalCount%pageSize==0?(totalCount/pageSize):(totalCount/pageSize)+1;

    }


    public static PageReultDto success(long totalCount, long pageIdx, long pageSize, Object content){
        return new PageReultDto(true,200,"查询成功",totalCount,pageIdx,pageSize,content);
    }
}
